<div class="container-fluid">
	
<div class="col-md-3 bg-light dk b-r fl mt15" style="padding: 0;">
	
	<div class="wrapper bg b-b">
      <h3 class="m-n font-thin">型号</h3>
    </div>

    <div class="wrapper">
      <form class="ng-pristine ng-valid ng-submitted">
        <div class="form-group">
          <label>型号名称</label>
          <input type="text" class="input-sm form-control" ng-model="m.attr_name"
          value="{{m.attr_name}}" 
          >
        </div>


        <div class="form-group" ng-if="p.price_type == '0'">
          <label>商城卖价</label>
          <input type="text" class="input-sm form-control" ng-model="m.guide_price"
          value="{{m.guide_price}}" 
          >
        </div>


        <div class="form-group" ng-if="p.price_type == '0'">
          <label>成本价</label>
          <input type="text" class="input-sm form-control" ng-model="m.cost_price"
          value="{{m.cost_price}}" 
          >
        </div>


        <div class="form-group row" ng-if="p.price_type == '0'">
            <label class="col-sm-4 control-label">启用库存</label>
            <div class="col-sm-8">
              <label class="i-switch m-r">
                <input type="checkbox" 
                  ng-checked="m.stock_type == '1'"
                  name="m.stock_type"
                  ng-true-value="'1'"
                  ng-false-value="'0'"
                  ng-model="m.stock_type"
                >
                <i></i>
              </label>
            </div>

        </div>

        <div class="form-group" ng-if="m.stock_type == '1' && p.price_type == '0'" >
          <label>库存数量</label>
          <input type="text" class="input-sm form-control" ng-model="m.current_stock_num"
          value="{{m.current_stock_num}}" 
          >
        </div>


        <!-- <div class="form-group row">
            <label class="col-sm-12 control-label">购买限制</label>
            <div class="col-sm-12">
              <label class="i-checks  checkbox-inline">
                  <input type="radio" value="0" name="order_num_state"
                  ng-model="m.order_num_state"
                  >
                  <i></i>
                  不限制
                </label>

                <label class="i-checks  checkbox-inline">
                  <input type="radio" value="1" name="order_num_state"
                  ng-model="m.order_num_state"
                  >
                  <i></i>
                  群盟
                </label>

                <label class="i-checks  checkbox-inline">
                  <input type="radio" value="2" name="order_num_state"
                  ng-model="m.order_num_state"
                  >
                  <i></i>
                  商家
                </label>
            </div>

        </div>


        <div class="form-group" ng-if="m.order_num_state != '0'">
          <label>限制最大购买数量</label>
          <input type="text" class="input-sm form-control" ng-model="m.order_limit_num"
          value="{{m.order_limit_num}}" 
          >
        </div>
        
        <div class="form-group row" ng-if="m.order_num_state != '0'">
            <label class="col-sm-12 control-label">限制方式</label>
            <div class="col-sm-12">
              <label class="i-checks  checkbox-inline">
                  <input type="radio" value="0" name="order_limit_type"
                  ng-model="m.order_limit_type"
                  >
                  <i></i>
                  手机号
                </label>

                <label class="i-checks  checkbox-inline">
                  <input type="radio" value="1" name="order_limit_type"
                  ng-model="m.order_limit_type"
                  >
                  <i></i>
                  身份证
                </label>

            </div>

        </div>

         -->




        <div class="m-t-md m-b-md">
        	<button class="btn btn-sm btn-primary"
          ng-click="addModel()"
          >
        		添加一个型号
        	</button>
        </div>
      </form>
    </div>

</div>

<div class="col-md-9 fl">
	
	<div class="wrapper">
		
		<div class="panel panel-default" ng-repeat="obj in p.attrlist">
          
          <div class="wrapper-lg">
            <div ng-if="obj.opt.attr_name == '0'" style="cursor: pointer;" 
            ng-click="changeOpt(obj, 'attr_name')"
            >
              <strong>类型名称：</strong>{{obj.attr_name}} 
            </div>
            <div ng-if="obj.opt.attr_name == '1'"  class="input-group" 
            style="width: 400px; margin-bottom: 10px;" 
            >
              <input type="text" class="form-control" 
              ng-model="obj.attr_name"
              >
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="setAttrName(obj)"
                >OK</button>
              </span>
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="changeOpt(obj, 'attr_name')"
                >Cancel</button>
              </span>
            </div>


            <div ng-if="p.price_type == '0'">
            <div ng-if="obj.opt.guide_price == '0'" style="cursor: pointer;" 
            ng-click="changeOpt(obj, 'guide_price')"
            >
              <strong>商城价格：</strong>{{obj.guide_price}}
            </div>

            <div ng-if="obj.opt.guide_price == '1'"  class="input-group" 
            style="width: 200px; margin-bottom: 10px;" 
            >
              <input type="text" class="form-control" 
              ng-model="obj.guide_price"
              >
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="setGuidePrice(obj)"
                >OK</button>
              </span>
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="changeOpt(obj, 'guide_price')"
                >Cancel</button>
              </span>
            </div>

            <div ng-if="obj.opt.cost_price == '0'" style="cursor: pointer;" 
            ng-click="changeOpt(obj, 'cost_price')"
            >
              <strong>成本价格：</strong>{{obj.cost_price}}
            </div>

            <div ng-if="obj.opt.cost_price == '1'"  class="input-group" 
            style="width: 200px; margin-bottom: 10px;" 
            >
              <input type="text" class="form-control" 
              ng-model="obj.cost_price"
              >
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="setCostPrice(obj)"
                >OK</button>
              </span>
              <span class="input-group-btn">
                <button class="btn btn-default" type="button"
                ng-click="changeOpt(obj, 'cost_price')"
                >Cancel</button>
              </span>
            </div>

            <div style="cursor: pointer; "
            ng-if="obj.opt.stock == '0'"
            ng-click="changeOpt(obj,'stock')"
            >

              <strong>库存数量：</strong>
              <span ng-if="obj.stock_type == '0'">不限制</span>
              <span ng-if="obj.stock_type == '1'" >
                  {{obj.current_stock_num}}
              </span>

            </div>

            <div class="input-group" 
            ng-if="obj.opt.stock == '1'"
            >
                <div class="fl"><strong>库存数量：</strong></div>
                <label class="i-switch m-t-xs m-r fl">
                    <input type="checkbox" 
                      ng-checked="obj.stock_type == '1'"
                      name="stock_type"
                      ng-true-value="'1'"
                      ng-false-value="'0'"
                      ng-model="obj.stock_type"
                    >
                    <i></i>
                </label>
                <input type="text" class="fl" 
                  style="border: none; width: 50px; border-bottom: 1px solid #aaa;"
                  ng-show="obj.stock_type == '1'"
                  ng-model="obj.current_stock_num" 
                  value="{{obj.current_stock_num}}">

                <button type="button" class="btn btn-default btn-sm fl ml10"
                ng-click="setStock(obj)"
                >
                OK
                </button>

            </div>

            </div>


            <!-- <div class="form-group row">
                <label class="col-sm-12 control-label">购买限制</label>
                <div class="col-sm-12">
                  <label class="i-checks  checkbox-inline">
                      <input type="radio" value="0" name="order_num_state"
                      ng-model="m.order_num_state"
                      >
                      <i></i>
                      不限制
                    </label>

                    <label class="i-checks  checkbox-inline">
                      <input type="radio" value="1" name="order_num_state"
                      ng-model="m.order_num_state"
                      >
                      <i></i>
                      群盟
                    </label>

                    <label class="i-checks  checkbox-inline">
                      <input type="radio" value="2" name="order_num_state"
                      ng-model="m.order_num_state"
                      >
                      <i></i>
                      商家
                    </label>
                </div>

            </div> -->
          

            <!-- <div >
            <strong>限制购买：</strong>







            {{obj.order_limit_type}}
            </div> -->



            <button class="btn btn-default btn-primary" ng-if="obj.state == '0'"
            ng-click="up(obj)"
            >
              上架
            </button>

            <button class="btn btn-default btn-success" ng-if="obj.state == '1'"
            ng-click="down(obj)"
            >
              下架
            </button>

          </div>
    </div>

        

	</div>
</div>

	
</div>